test(scoring): cover sameLogin/sameRepoFullName edge cases in pending-pr-scenarios - #8484
Closed
xfodev wants to merge 1 commit into
Closed
Conversation
…-pr-scenarios (JSONbored#8329) loadContributorRepoOpenPrSignalRecords filters a contributor's open PRs via sameLogin (whose `value &&` short-circuit handles a null/undefined authorLogin from ghost/deleted accounts) and sameRepoFullName (case-insensitive). Neither the falsy-authorLogin branch nor the case-normalization was exercised. Add three tests: PRs with null/undefined authorLogin are excluded (short-circuit, no throw on the null .toLowerCase()); a repoFullName differing only in case still matches; an authorLogin differing only in case still matches. No production code changed. Closes JSONbored#8329
Contributor
|
LoopOver closed this because @xfodev has 3 open pull requests, above this repository's configured limit of 2. Close or merge an existing one to open a new one. This is an automated maintenance action. |
Contributor
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
loadContributorRepoOpenPrSignalRecords(src/scoring/pending-pr-scenarios.ts) filters a contributor's open PRs via two helpers whose edge branches had no coverage:sameLogin(value, login)— itsvalue &&short-circuit handlesPullRequestRecord.authorLoginbeingnull/undefined(ghost/deleted GitHub accounts). No test proved such a PR is excluded rather than matching by accident or throwing onnull.toLowerCase().sameRepoFullName/sameLogincase-insensitivity — no test proved case-differing repo/login values still match.Add three tests (mirroring the existing
loadContributorRepoOpenPrSignalRecordstest'svi.spyOnharness): null + undefinedauthorLoginare excluded via the short-circuit; arepoFullNamediffering only in case still matches; anauthorLogindiffering only in case still matches.Pure test-addition — no production code changed.
Tests
test/unit/pending-pr-scenarios.test.ts— +3 tests (20 pass). Covers both operands ofsameLogin'svalue &&(falsy null/undefined + truthy case-differing) and both helpers'.toLowerCase()normalization.Validation
test/unit/pending-pr-scenarios.test.tsgreen (20/20).src/**diff); no secret/wallet/hotkey/trust/reward terms.Closes #8329